package com.liming.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author liming
 * @date 2025/4/14
 */
@Getter
@AllArgsConstructor
public enum RefundApplyStatusEnum {

    // 退款申请状态 0 用户申请退款 1 商家同意 2商家拒绝
    USER_APPLY(0, "用户申请退款"),
    MERCHANT_AGREE(1, "商家同意"),
    MERCHANT_REFUSE(2, "商家拒绝");

    private final Integer code;
    private final String message;

    public static RefundApplyStatusEnum getEnumByCode(Integer code) {
        for (RefundApplyStatusEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }

    public static String getMessageByCode(Integer code) {
        for (RefundApplyStatusEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value.getMessage();
            }
        }
        return null;
    }
}
